<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>vue属性操作</title>
    <style type="text/css">
        #div-1 {
            /*width: 300px;*/
            /*height: 300px;*/
            background-color: #f7e1b5;
        }

        .div1 {
            width: 100px;
            height: 100px;
            background: deeppink;
        }

        .div2 {
            border: 10px solid #304701;
        }

    </style>
    <script src="../js/vue.js"></script>
</head>
<body>
<div id="vue-3—top">
    <div id="div-1" @click="click1()">
        <button type="button" @click="btn()">点击</button>
        <br><br>
        <div :class="{div1:styleFlag,div2:styleFlag}">class属性</div>
        <br><br>
        <div :class="style1">class属性</div>
        <br><br>
        <div :class="style2">class属性</div>
        <br><br><br>
        <div :style="styleOperation">style操作</div>
    </div>
</div>
</body>
<script type="text/javascript">
    Vue.config.keyCodes = {
        "aa": 65
    };

    let vm = new Vue({
        el: '#vue-3—top',
        data: {
            styleFlag: true,
            style1: 'div1',
            style2: 'div2',
            styleOperation: {
                border: '15px solid red',
                fontSize: '30px',
                color: '#fffdfd',
                backgroundColor: '#ac0707',
                width: '200px',
                height: '200px',
                textAlign: 'center',
                lineHeight: '200px'
            }
        },
        methods: {
            click1() {
                // alert('一被点击了');
                console.log('一被点击了');
            },
            btn() {
                vm.styleFlag = !vm.styleFlag;
            }
        }
    });
</script>
</html>